# -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models


class Migration(SchemaMigration):

    def forwards(self, orm):
        # Adding model 'DailyCounsel'
        db.create_table(u'institutes_dailycounsel', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('date', self.gf('django.db.models.fields.DateField')(db_index=True)),
            ('institute', self.gf('django.db.models.fields.CharField')(max_length=20)),
            ('author', self.gf('django.db.models.fields.CharField')(max_length=20)),
            ('content', self.gf('django.db.models.fields.TextField')()),
        ))
        db.send_create_signal(u'institutes', ['DailyCounsel'])

        # Adding unique constraint on 'DailyCounsel', fields ['date', 'institute', 'author']
        db.create_unique(u'institutes_dailycounsel', ['date', 'institute', 'author'])

        # Adding model 'DailyMeeting'
        db.create_table(u'institutes_dailymeeting', (
            (u'id', self.gf('django.db.models.fields.AutoField')(primary_key=True)),
            ('date', self.gf('django.db.models.fields.DateField')(db_index=True)),
            ('institute', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['basic_info.Institute'])),
            ('stock', self.gf('django.db.models.fields.related.ForeignKey')(to=orm['basic_info.Stock'])),
            ('static_summary', self.gf('django.db.models.fields.TextField')()),
            ('url', self.gf('django.db.models.fields.URLField')(max_length=200)),
        ))
        db.send_create_signal(u'institutes', ['DailyMeeting'])

        # Adding unique constraint on 'DailyMeeting', fields ['date', 'institute', 'stock']
        db.create_unique(u'institutes_dailymeeting', ['date', 'institute_id', 'stock_id'])


    def backwards(self, orm):
        # Removing unique constraint on 'DailyMeeting', fields ['date', 'institute', 'stock']
        db.delete_unique(u'institutes_dailymeeting', ['date', 'institute_id', 'stock_id'])

        # Removing unique constraint on 'DailyCounsel', fields ['date', 'institute', 'author']
        db.delete_unique(u'institutes_dailycounsel', ['date', 'institute', 'author'])

        # Deleting model 'DailyCounsel'
        db.delete_table(u'institutes_dailycounsel')

        # Deleting model 'DailyMeeting'
        db.delete_table(u'institutes_dailymeeting')


    models = {
        u'basic_info.institute': {
            'Meta': {'object_name': 'Institute'},
            'full_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
            'short_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'primary_key': 'True'})
        },
        u'basic_info.stock': {
            'Meta': {'object_name': 'Stock'},
            'code': ('django.db.models.fields.CharField', [], {'max_length': '8', 'primary_key': 'True'}),
            'csrc_industry': ('django.db.models.fields.CharField', [], {'max_length': '40'}),
            'csrc_sub_industry': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
            'full_name': ('django.db.models.fields.CharField', [], {'max_length': '100', 'blank': 'True'}),
            'pinyin_name': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
            'short_name': ('django.db.models.fields.CharField', [], {'max_length': '20', 'db_index': 'True'})
        },
        u'institutes.dailycounsel': {
            'Meta': {'unique_together': "(('date', 'institute', 'author'),)", 'object_name': 'DailyCounsel'},
            'author': ('django.db.models.fields.CharField', [], {'max_length': '20'}),
            'content': ('django.db.models.fields.TextField', [], {}),
            'date': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'institute': ('django.db.models.fields.CharField', [], {'max_length': '20'})
        },
        u'institutes.dailymeeting': {
            'Meta': {'unique_together': "(('date', 'institute', 'stock'),)", 'object_name': 'DailyMeeting'},
            'date': ('django.db.models.fields.DateField', [], {'db_index': 'True'}),
            u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),
            'institute': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['basic_info.Institute']"}),
            'static_summary': ('django.db.models.fields.TextField', [], {}),
            'stock': ('django.db.models.fields.related.ForeignKey', [], {'to': u"orm['basic_info.Stock']"}),
            'url': ('django.db.models.fields.URLField', [], {'max_length': '200'})
        }
    }

    complete_apps = ['institutes']